<template>
  <div id="loginContainlist" v-cloak>
    <div class="weui-cells__title">{{info}}</div>
    <div class="weui-btn-area" v-for="item in configList">
      <a class="weui-btn weui-btn_primary" @click="select(item)" href="javascript:">{{item.mpName}}</a>
    </div>
  </div>



</template>

<script>
  export default {
    data: function () {
      return {
        configList: [],
        info: ''
      }
    },
    created: function () {
      this.axios.get('wx_gateway/debugging/v1/mp_configs').then((res) =>{
        this.configList = res.data.data.configs;
        this.info = '请选择要调试的公众号：';
        $('#loginContainlist').animateCss('bounceInRight', function() {
          // Do somthing after animation
          // window.location = '/list'

        });
      }).catch((err) =>{
        weui.topTips(err.response.data.errorMessage,{
          className: 'topTipsStype',
        })
      });
    },
    methods: {
      select(item) {
        localStorage.setItem('mpId', item.mpId);
        localStorage.setItem('selectItem', JSON.stringify(item));
        let that = this;
        setTimeout(function () {
          that.$router.push('/qrcode?codeRul='+item.qrCode)
        },500);
        $('#loginContainlist').animateCss('bounceOutLeft', function() {
          // Do somthing after animation
        });
      }

    }
  }
</script>

<style scoped>
[v-cloak]{
  display: none;

}

</style>
